<template>
    <div id="app">
        <div style="height:1px"></div>
        <transition name="slide-fade">
            <loadCard v-if="CardStatus"></loadCard>
        </transition>
        <transition name="slide-fade">
            <contentView v-if="!CardStatus" ref="contentView"></contentView>
        </transition>
    </div>
</template>

<script>

import loadCard from './loadCard.vue'
import contentView from './content.vue'

export default {
    components: {
        loadCard,
        contentView
    },
    name: 'App',
    data() {
        return {
            CardStatus: true,
        }
    },
    mounted() {
        this.$bus.$on('hide-card', () => {
            this.CardStatus = false;
        });
        this.$bus.$on('show-card', () => {
            this.CardStatus = true;
        });
    },
    methods: {

    }
}
</script>

<style scoped>
/* 可以设置不同的进入和离开动画 */
/* 设置持续时间和动画函数 */
.slide-fade-enter-active {
    transition: all 0.3s ease;
}
.slide-fade-leave-active {
    transition: all 0.3s cubic-bezier(1, 0.5, 0.8, 1);
}
.slide-fade-enter {
    transform: translateX(50px);
    opacity: 0;
}

.slide-fade-leave-to {
    transform: translateX(50px);
    opacity: 0;
}
</style>
